package org.adkii.core.proxy.jdk;

import org.adkii.core.proxy.statics.RealSubject;
import org.adkii.core.proxy.statics.Subject;

import java.lang.reflect.Proxy;

/**
 * @author malingdi
 * @description
 * @date 2025/5/12 21:29
 */
public class Main {
    public static void main(String[] args) {
        Subject target = new RealSubject();
        // 使用方式
        Subject proxy = (Subject) Proxy.newProxyInstance(
                target.getClass().getClassLoader(),
                target.getClass().getInterfaces(),
                new MyInvocationHandler(target));
        proxy.request();
    }
}
